package hu.ikti.oamadmin.beans.serviceprofile;

import hu.ikti.oamadmin.beans.BaseBean;
import hu.ikti.oamadmin.types.entities.ServiceProfile;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

import org.jboss.seam.ScopeType;
import org.jboss.seam.annotations.Factory;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.annotations.Out;
import org.jboss.seam.annotations.Scope;

@Name("serviceprofileBean")
@Scope(ScopeType.SESSION)
public class ServiceprofileBean extends BaseBean implements Serializable {

	private static final long serialVersionUID = 1L;

	@Out(scope = ScopeType.SESSION)
	private List<ServiceProfile> serviceprofileList;

	@Factory("serviceprofileList")
	public void getServiceprofiles() {
		List<?> results = entityManager.createQuery(
				"select serviceprofile from ServiceProfile serviceprofile")
				.getResultList();
		if (results != null) {
			serviceprofileList = new ArrayList<ServiceProfile>();
			for (Object object : results) {
				serviceprofileList.add((ServiceProfile) object);
			}
		}
	}

}
